<!doctype html>
<div style="position: fixed; height: 5000px; width: 100px; background: lightblue; will-change: transform"></div>
<div style="position: fixed; top: 25px; height: 100px; width: 100px; background: lightgray"></div>
<div id="foo" style="position: fixed; top: 50px; height: 100px; width: 100px; background: lightgray"></div>
<script src="../../resources/run-after-layout-and-paint.js"></script>
<script>
// This test verifies that a repaint request for a squashed layer that is position:fixed into another position: fixed layer
// issue the correct paint invalidations even with the window scrolled.

if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}
runAfterLayoutAndPaint(function() {
    if (window.internals)
        internals.startTrackingRepaints(document);

    var output = '';
    
    document.getElementById("foo").style.background = 'red';
    
    if (window.internals)
        output += internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_INVALIDATIONS) + ' ';

    if (window.internals)
        internals.stopTrackingRepaints(document);

    scrollTo(0, 50);

    if (window.internals)
        internals.startTrackingRepaints(document);
    
    document.getElementById("foo").style.background = 'blue';
    
    if (window.internals)
        output += internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_INVALIDATIONS);

    if (window.internals)
        internals.stopTrackingRepaints(document);

    testRunner.setCustomTextOutput(output);

    if (window.testRunner)
        testRunner.notifyDone();
});

</script>